Get the smallest numberΒΆ
Get the smallest number from a list.
def smallest_num_in_list(L):
min = L[ 0 ]
for x in L:
if x < min:
min = x
return min
# test
print(smallest_num_in_list([1, 2, -8, 0])) # -8